package faceoff.sample;

import model.Board;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.naver.hdfs.HDFSBoardBO;


public class ApplicationContextMain {
	public static String APPLICATION_CONTEXT = "applicationContext-hdfs.xml";
	public HDFSBoardBO hdfsBoardBO;
	
	public static void main(String[] args) {
		ApplicationContextMain main = new ApplicationContextMain();
		main.setUpBefore();
		main.test();
	}

	public void setUpBefore() {
		ApplicationContext context = new ClassPathXmlApplicationContext(APPLICATION_CONTEXT);
		
		hdfsBoardBO = (HDFSBoardBO) context.getBean("hdfsBoardBO");
	}
	
	public void test() {
		Board board = new Board(1, "title", "content");
		hdfsBoardBO.write(board, true);
		board = hdfsBoardBO.select(1);
		System.out.println(board.getArticleNo());
		System.out.println(board.getTitle());
		System.out.println(board.getContent());
		hdfsBoardBO.delete(0L);
	}
}
